<?php

namespace App\Requests;

use Framework\BaseRequest;

/**
 * @method phone
 * @method code
 * @method key
 * @method type
 */
class SendImgCodeRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'phone' => [
                'required',
                'regex:/^13\d{9}$|^14\d{9}$|^15\d{9}$|^16\d{9}$|^17\d{9}$|^18\d{9}|^19\d{9}$/',
                'max:11'
            ],
            'key' => ['required'],
            'code' => ['required','max:4'],
        ];
    }

    public function messages()
    {
        return [
            'phone.required' => '手机号不能为空',
            'phone.max' => '手机号最大长度为11个字符',
        ];
    }
}
